Fix release workflow: sync main to gh-pages and deploy from gh-pages branch#778
Fix release workflow: sync main to gh-pages and deploy from gh-pages branch#778
Conversation
Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
|
@copilot Keep using actions/upload-pages-artifact@v4 + actions/deploy-pages@v4. Add a workflow to sync current main branch to gh-pages branch and use gh-pages branch as trigger branch for actions/deploy-pages. |
…es workflow Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
Done in 7d9868b. Reverted Deployment flow:
Since |
|
@copilot When I run release yaml, it runs sync-gh-pages.yml first and then the rest of yaml file. |
Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com>
Done in 2cf9874. The release workflow now calls The To deploy: trigger "Release Awesome Azd" from the |
There was a problem hiding this comment.
Pull request overview
Fixes the GitHub Pages release workflow by ensuring the deployment is triggered from an allowed branch (gh-pages) while still deploying the latest main content.
Changes:
- Adds a reusable workflow to force-sync
main→gh-pages. - Makes the release workflow run the sync job first and deploy from
gh-pages. - Updates
actions/upload-pages-artifactfromv3tov4and adjusts permissions for pushing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/sync-gh-pages.yml | Introduces a reusable workflow to sync main to gh-pages via force-push. |
| .github/workflows/release.yml | Runs the sync workflow before deploy, checks out gh-pages for the build, and bumps the upload artifact action to v4. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The
release.ymlworkflow was failing becauseactions/deploy-pagesrequires the triggering branch (main) to be explicitly allowed in thegithub-pagesenvironment protection rules.Changes
actions/upload-pages-artifactfrom v3 to v4 inrelease.yml, keeping the existingactions/deploy-pages@v4deployment approachsync-gh-pages.ymlreusable workflow that syncs themainbranch togh-pagesby force-pushing (supports bothworkflow_dispatchfor standalone use andworkflow_callfor reuse)sync-gh-pages.ymlas the first job inrelease.yml— the deploy job depends on it (needs: sync), so running the release workflow automatically syncs main→gh-pages before building and deployingcontents: write(needed for the sync push) and deploy job now checks out thegh-pagesbranch to use the freshly synced codeDeployment Flow
gh-pagesbranch in the Actions UIsyncjob automatically pushes the latestmaincontent togh-pagesdeployjob builds from the freshly syncedgh-pagesbranch and deploys viaactions/deploy-pages@v4— sincegh-pagesis the trigger branch, thegithub-pagesenvironment protection rules are satisfiedOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.